package com.clm.controller.user;

import com.clm.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

/**
 * @Author dinghuapeng
 * @Date 2023/11/5 14:31
 * @PackageName:com.clm.controller.admin
 * @ClassName: ShopController
 * @Description: TODO
 * @Version 1.0
 */

@RestController("userShopControler")
@Slf4j
@RequestMapping("/user/shop")
@Api(tags = "店铺相关设置")
public class ShopController {

    @Autowired
    private RedisTemplate redisTemplate;

    /**
     * 用户获取店铺状态
     * @return
     */
    @GetMapping("/status")
    @ApiOperation("获取店铺营业状态")
    public Result<Integer> getStatus(){
        Integer status =(Integer) redisTemplate.opsForValue().get("SHOP_STATUS");
        log.info("获取店铺状态：{}",status==1?"营业中":"休息中");
        return Result.success(status);
    }
}
